<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
		    	xmlns:rich="http://richfaces.org/rich"
		    	xmlns:a="http://richfaces.org/a4j"
	            xmlns:p="http://primefaces.prime.com.tr/ui" 
    			xmlns:kiwi="http://www.kiwi-project.eu/jsf">
	<!--<p:tab title="References">-->
            <div>
               <b>Incoming</b>
                <rich:tree style="width:150px" switchType="client">
                    <rich:recursiveTreeNodesAdaptor
                          roots="#{referencesWidget.incoming}"
                          var="item"
                          nodes="#{item.children}">
                        <rich:treeNode>
                            <s:link view="/home.xhtml" style="font-weight: bold;" rendered="#{not item.inferred}" value="#{item.data.label} (#{item.data.namespacePrefix})"  propagation="none">
                                <f:param name="title"/>
                                <f:param name="uri"/>
                                <f:param name="id" />
                                <f:param name="kiwiid" value="#{item.data.kiwiIdentifier}"/>
                            </s:link>
                            <s:div styleClass="referenceLink" rendered="#{item.inferred}" >
                            <s:link style="font-style: italic;" rendered="#{item.inferred}" view="/home.xhtml" value="#{item.data.label} (#{item.data.namespacePrefix})"  propagation="none">
                                <f:param name="title"/>
                                <f:param name="uri"/>
                                <f:param name="id" />
                                <f:param name="kiwiid" value="#{item.data.kiwiIdentifier}"/>
                                <s:div style="display:none">
							            <f:facet name="defaultContent">
							                <strong>Please wait...</strong>
							            </f:facet>
                                
										<h:dataTable value="#{explanationService.explainTripleTextually(item.tripleId, true)}" var="story">
										  <h:column>
						                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
						                	<br/>
										  	<h:dataTable value="#{story.body}" var="line">
										  		<h:column>
										  			<h:outputText value="#{line.body}" escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
										  		</h:column>
										  	</h:dataTable>									  	 
										  	<br/> <br/>
										  </h:column>
										</h:dataTable>						                
                                </s:div>
                            </s:link>
                            </s:div>
                        </rich:treeNode>
                    </rich:recursiveTreeNodesAdaptor>
                </rich:tree>
                <s:span style="color:red; text-align: center;" rendered="#{referencesWidget.incomingCount==referencesWidget.limit}"><center>more than <h:outputText value="#{referencesWidget.limit}" /> links</center></s:span>
            </div>

            <div style="margin-top: 1em;">
               <b>Outgoing</b>
                <rich:tree style="width:150px" switchType="client">
                    <rich:recursiveTreeNodesAdaptor
                          roots="#{referencesWidget.outgoing}"
                          var="item"
                          nodes="#{item.children}">
                        <rich:treeNode>
                            <s:link view="/home.xhtml" rendered="#{not item.inferred}" style="font-weight: bold;" value="#{item.data.label} (#{item.data.namespacePrefix})"  propagation="none">
                                <f:param name="title"/>
                                <f:param name="uri"/>
                                <f:param name="id" />
                                <f:param name="kiwiid" value="#{item.data.kiwiIdentifier}"/>
                            </s:link>
                            <s:div styleClass="referenceLink" rendered="#{item.inferred}" >
                            <s:link view="/home.xhtml" style="font-style: italic;" value="#{item.data.label} (#{item.data.namespacePrefix})"  propagation="none">
                                <f:param name="title"/>
                                <f:param name="uri"/>
                                <f:param name="id" />
                                <f:param name="kiwiid" value="#{item.data.kiwiIdentifier}"/>
 
                                <s:div style="display:none">
							            <f:facet name="defaultContent">
							                <strong>Please wait...</strong>
							            </f:facet>
                                
										<h:dataTable value="#{explanationService.explainTripleTextually(item.tripleId, true)}" var="story">
										  <h:column>
						                	<h:outputText value="#{story.openingLine.body}" escape="false" style="font-weight:bold"/><h:outputText value=" #{story.openingLine.connective}" style="margin-left:5px"/>
						                	<br/>
										  	<h:dataTable value="#{story.body}" var="line">
										  		<h:column>
										  			<h:outputText value="#{line.body}"  escape="false" style="font-weight:bold; margin-left:15px"/> <h:outputText value=" #{line.connective}" style="margin-left:5px"/> <br/>
										  		</h:column>
										  	</h:dataTable>
										  	 
										  	<br/> <br/>
										  </h:column>
										</h:dataTable>						                
                                </s:div>                
                            </s:link>
                            </s:div>
                            
                        </rich:treeNode>
                    </rich:recursiveTreeNodesAdaptor>
                </rich:tree>
                
                <s:span style="color:red;" rendered="#{referencesWidget.outgoingCount==referencesWidget.limit}"><center>more than <h:outputText value="#{referencesWidget.limit}" /> links</center></s:span>

            </div>
	<!--</p:tab>-->
</ui:composition>